﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;

namespace WindowsFormsApplication2
{
    public class my58HousePub : BoundaryPostData
    {

        public my58HousePub(CookieCollection ck)
            : base(ck)
        {


        }
        /// <summary>
        /// 小区id
        /// </summary>
        public string xiaoqu { get; set; }

        public string xiaoquname { get; set; }

        /// <summary>
        /// 区域id
        /// </summary>
        public string localArea { get; set; }
        /// <summary>
        /// 地段id
        /// </summary>

        public string localDiduan { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string dizhi { get; set; }

        public string area { get; set; }

        /// <summary>
        /// 楼层
        /// </summary>
        public string Floor { get; set; }
        public string zonglouceng { get; set; }
        /// <summary>
        /// 价格
        /// </summary>
        public string MinPrice { get; set; }


        public string Title { get; set; }

        public string Content { get; set; }
        /// <summary>
        /// 图片:/p1/big/n_v1bkuymc6hs5ffmgouxa2a.jpg|/p1/big/n_v1bl2lwkojs5ffns4adzma.jpg
        /// </summary>
        public string Pic { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>
        public string goblianxiren { get; set; }
        /// <summary>
        /// 手机
        /// </summary>
        public string Phone { get; set; }

        public string userid { get; set; }
        /// <summary>
        /// 套间面积;出售特有
        /// </summary>
        public string taoneimianji { get; set; }


        private string _HireType;

        /// <summary>
        /// HireType:租售类型
        /// </summary>
        public string HireType
        {
            get
            {

                if (string.IsNullOrEmpty(_HireType))
                {
                    return "2";
                }
                else
                {
                    return _HireType;
                }
            }
            set
            {
                _HireType = value;
            }
        }

        private string _isBiz;
        /// <summary>
        /// isBiz:0非企业
        /// </summary>
        public string isBiz
        {
            get
            {

                if (string.IsNullOrEmpty(_isBiz))
                {
                    return "0";
                }
                else
                {
                    return _isBiz;
                }
            }
            set
            {
                _isBiz = value;
            }
        }


        private string _huxingshi;
        /// <summary>
        /// huxingshi:室
        /// </summary>
        public string huxingshi
        {
            get
            {

                if (string.IsNullOrEmpty(_huxingshi))
                {
                    return "1";
                }
                else
                {
                    return _huxingshi;
                }
            }
            set
            {
                _huxingshi = value;
            }
        }

        private string _huxingting;
        /// <summary>
        /// huxingting:
        /// </summary>
        public string huxingting
        {
            get
            {

                if (string.IsNullOrEmpty(_huxingting))
                {
                    return "1";
                }
                else
                {
                    return _huxingting;
                }
            }
            set
            {
                _huxingting = value;
            }
        }
        private string _huxingwei;
        /// <summary>
        /// huxingwei:
        /// </summary>
        public string huxingwei
        {
            get
            {

                if (string.IsNullOrEmpty(_huxingwei))
                {
                    return "1";
                }
                else
                {
                    return _huxingwei;
                }
            }
            set
            {
                _huxingwei = value;
            }
        }
        private string _Toward;
        /// <summary>
        /// Toward:朝向南5
        /// </summary>
        public string Toward
        {
            get
            {

                if (string.IsNullOrEmpty(_Toward))
                {
                    return "5";
                }
                else
                {
                    return _Toward;
                }
            }
            set
            {
                _Toward = value;
            }
        }
        private string _FitType;
        /// <summary>
        /// FitType:2精装修
        /// </summary>
        public string FitType
        {
            get
            {

                if (string.IsNullOrEmpty(_FitType))
                {
                    return "2";
                }
                else
                {
                    return _FitType;
                }
            }
            set
            {
                _FitType = value;
            }
        }

        private string _ObjectType;
        /// <summary>
        /// ObjectType:住宅类型普通住宅
        /// </summary>
        public string ObjectType
        {
            get
            {

                if (string.IsNullOrEmpty(_ObjectType))
                {
                    return "3";
                }
                else
                {
                    return _ObjectType;
                }
            }
            set
            {
                _ObjectType = value;
            }
        }
        private string _HouseAllocation;
        /// <summary>
        /// HouseAllocation:房屋配置6|15默认床衣柜
        /// </summary>
        public string HouseAllocation
        {
            get
            {

                if (string.IsNullOrEmpty(_HouseAllocation))
                {
                    return "6";
                }
                else
                {
                    return _HouseAllocation;
                }
            }
            set
            {
                _HouseAllocation = value;
            }
        }

        private string _fukuanfangshi;
        /// <summary>
        /// fukuanfangshi:付款方式1押一付三
        /// </summary>
        public string fukuanfangshi
        {
            get
            {

                if (string.IsNullOrEmpty(_fukuanfangshi))
                {
                    return "1";
                }
                else
                {
                    return _fukuanfangshi;
                }
            }
            set
            {
                _fukuanfangshi = value;
            }
        }
        private string _globalQQOpenId;
        /// <summary>
        /// globalQQOpenId:
        /// </summary>
        public string globalQQOpenId
        {
            get
            {

                if (string.IsNullOrEmpty(_globalQQOpenId))
                {
                    return "";
                }
                else
                {
                    return _globalQQOpenId;
                }
            }
            set
            {
                _globalQQOpenId = value;
            }
        }
        private string _postparam_openidtype;
        /// <summary>
        /// postparam_openidtype:
        /// </summary>
        public string postparam_openidtype
        {
            get
            {

                if (string.IsNullOrEmpty(_postparam_openidtype))
                {
                    return "";
                }
                else
                {
                    return _postparam_openidtype;
                }
            }
            set
            {
                _postparam_openidtype = value;
            }
        }


        private string _cube_post_jsonkey;
        /// <summary>
        /// cube_post_jsonkey:推广信息
        /// </summary>
        public string cube_post_jsonkey
        {
            get
            {

                if (string.IsNullOrEmpty(_cube_post_jsonkey))
                {
                    return "";
                }
                else
                {
                    return _cube_post_jsonkey;
                }
            }
            set
            {
                _cube_post_jsonkey = value;
            }
        }
        private string _captcha_type;
        /// <summary>
        /// captcha_type:验证类型400
        /// </summary>
        public string captcha_type
        {
            get
            {

                if (string.IsNullOrEmpty(_captcha_type))
                {
                    return "";
                }
                else
                {
                    return _captcha_type;
                }
            }
            set
            {
                _captcha_type = value;
            }
        }
        private string _captcha_input;
        /// <summary>
        /// captcha_input:手机验证码输入
        /// </summary>
        public string captcha_input
        {
            get
            {

                if (string.IsNullOrEmpty(_captcha_input))
                {
                    return "";
                }
                else
                {
                    return _captcha_input;
                }
            }
            set
            {
                _captcha_input = value;
            }
        }

        private string _GTID;
        /// <summary>
        /// GTID:
        /// </summary>
        public string GTID
        {
            get
            {

                if (string.IsNullOrEmpty(_GTID))
                {
                    return "";
                }
                else
                {
                    return _GTID;
                }
            }
            set
            {
                _GTID = value;
            }
        }
        #region 出售特有有字段
        private string _type;
        /// <summary>
        /// type:类型0出售,求购其他
        /// </summary>
        public string type
        {
            get
            {

                if (string.IsNullOrEmpty(_type))
                {
                    return "0";
                }
                else
                {
                    return _type;
                }
            }
            set
            {
                _type = value;
            }
        }
        private string _fittype;
        /// <summary>
        /// fittype:装修类型2精装修
        /// </summary>
        public string fittype
        {
            get
            {

                if (string.IsNullOrEmpty(_fittype))
                {
                    return "2";
                }
                else
                {
                    return _fittype;
                }
            }
            set
            {
                _fittype = value;
            }
        }
        private string _chanquannianxian;
        /// <summary>
        /// chanquannianxian:产权年限
        /// </summary>
        public string chanquannianxian
        {
            get
            {

                if (string.IsNullOrEmpty(_chanquannianxian))
                {
                    return "";
                }
                else
                {
                    return _chanquannianxian;
                }
            }
            set
            {
                _chanquannianxian = value;
            }
        }


        private string _chanquan;
        /// <summary>
        /// chanquan:产权类型1
        /// </summary>
        public string chanquan
        {
            get
            {

                if (string.IsNullOrEmpty(_chanquan))
                {
                    return "1";
                }
                else
                {
                    return _chanquan;
                }
            }
            set
            {
                _chanquan = value;
            }
        }
        private string _jianzhuniandai;
        /// <summary>
        /// jianzhuniandai:建筑年代
        /// </summary>
        public string jianzhuniandai
        {
            get
            {

                if (string.IsNullOrEmpty(_jianzhuniandai))
                {
                    return "1999";
                }
                else
                {
                    return _jianzhuniandai;
                }
            }
            set
            {
                _jianzhuniandai = value;
            }
        }
        private string _fangyuantese;
        /// <summary>
        /// fangyuantese:房源特色空
        /// </summary>
        public string fangyuantese
        {
            get
            {

                if (string.IsNullOrEmpty(_fangyuantese))
                {
                    return "";
                }
                else
                {
                    return _fangyuantese;
                }
            }
            set
            {
                _fangyuantese = value;
            }
        }

        #endregion
        /// <summary>
        /// 出租
        /// </summary>
        /// <param name="allowdir"></param>
        /// <param name="urla"></param>
        /// <param name="postdata"></param>
        /// <returns></returns>
        public string doreqoutPub2(bool allowdir, string urla, string postdata)
        {

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urla);

            req.CookieContainer = new CookieContainer();
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/7.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0E; .NET4.0C; Tablet PC 2.0; InfoPath.3)";

            //11.11 
            req.CookieContainer.Add(cklist);
            req.Headers.Add("Upgrade-Insecure-Requests", "1");
            req.Referer = "http://www.ganji.com/pub/pub.php?act=pub&method=load&cid=7&mcid=20&domain=nb";
            req.Method = "POST";
            if (this.wp != null)
            {
                req.Proxy = wp;
            }
            req.AllowAutoRedirect = allowdir;


            req.Method = "POST";

            StringBuilder sb = new StringBuilder();

            sb.Append("HireType=" + HttpUtility.UrlEncode(HireType) + "&");

            sb.Append("isBiz=" + HttpUtility.UrlEncode(isBiz) + "&");
            sb.Append("xiaoqu=" + HttpUtility.UrlEncode(xiaoqu) + "&");
            sb.Append("xiaoquname=" + HttpUtility.UrlEncode(xiaoquname) + "&");
            sb.Append("localArea=" + HttpUtility.UrlEncode(localArea) + "&");



            sb.Append("localDiduan=" + HttpUtility.UrlEncode(localDiduan) + "&");
            sb.Append("dizhi=" + HttpUtility.UrlEncode(dizhi) + "&");
            sb.Append("huxingshi=" + HttpUtility.UrlEncode(huxingshi) + "&");
            sb.Append("huxingting=" + HttpUtility.UrlEncode(huxingting) + "&");





            sb.Append("huxingwei=" + HttpUtility.UrlEncode(huxingwei) + "&");
            sb.Append("area=" + HttpUtility.UrlEncode(area) + "&");
            sb.Append("Floor=" + HttpUtility.UrlEncode(Floor) + "&");
            sb.Append("zonglouceng=" + HttpUtility.UrlEncode(zonglouceng) + "&");






            sb.Append("Toward=" + HttpUtility.UrlEncode(Toward) + "&");
            sb.Append("FitType=" + HttpUtility.UrlEncode(FitType) + "&");
            sb.Append("ObjectType=" + HttpUtility.UrlEncode(ObjectType) + "&");
            sb.Append("HouseAllocation=" + HttpUtility.UrlEncode(HouseAllocation) + "&");
            sb.Append("MinPrice=" + HttpUtility.UrlEncode(MinPrice) + "&");







            sb.Append("fukuanfangshi=" + HttpUtility.UrlEncode(fukuanfangshi) + "&");
            sb.Append("Title=" + HttpUtility.UrlEncode(Title) + "&");
            sb.Append("Content=" + HttpUtility.UrlEncode(Content) + "&");
            sb.Append("Pic=" + HttpUtility.UrlEncode(Pic) + "&");






            sb.Append("goblianxiren=" + HttpUtility.UrlEncode(goblianxiren) + "&");
            sb.Append("globalQQOpenId=" + HttpUtility.UrlEncode(globalQQOpenId) + "&");
            sb.Append("postparam_openidtype=" + HttpUtility.UrlEncode(postparam_openidtype) + "&");
            sb.Append("Phone=" + HttpUtility.UrlEncode(Phone) + "&");







            sb.Append("cube_post_jsonkey=" + HttpUtility.UrlEncode(cube_post_jsonkey) + "&");
            sb.Append("userid=" + HttpUtility.UrlEncode(userid) + "&");
            sb.Append("captcha_type=" + HttpUtility.UrlEncode(captcha_type) + "&");
            sb.Append("captcha_input=" + HttpUtility.UrlEncode(captcha_input) + "&");





            sb.Append("GTID=" + HttpUtility.UrlEncode(GTID) + "&");


            byte[] bs = Encoding.UTF8.GetBytes(sb.ToString());

            string pt = "application/x-www-form-urlencoded; charset=UTF-8";
            req.ContentType = pt;
            req.ContentLength = bs.Length;
            req.Accept = "gzip, deflate";
            // req.CookieContainer = new System.Net.CookieContainer();
            //   req.CookieContainer.Add( strCokAddColnew("lg=1; ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; __utma=32156897.89665725.1446446419.1446446419.1446685942.2; __utmz=32156897.1446446419.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); undefined=0b599f13-59bb-4046-a877-352f7c5bc2c5; citydomain=nb; NTKF_T2D_CLIENTID=guest016AF395-C541-D138-A824-C6F7D48CE723; sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; __utmb=32156897.10.10.1446685942; __utmt=1; 58uuid=d60ba0ca-88f0-4122-bbf5-a6cda97fde62; last_name=elingsoft123; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A33801389483%7D; __utmc=32156897; GANJISESSID=ac5c6e3d6fe1e048616e1913f6266fa9",".ganji.com",new CookieCollection()));
            //11.11
            // req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=5170713550418216074941; ganji_xuuid=a00bd1e8-8802-4d0f-8737-20af1e6f4f17; undefined=51fcc4f3-d030-4435-85e1-171248097f40; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; bdshare_firstime=1446620003045; 58uuid=a8a7d56c-88fd-46a0-872a-85a370f9b007; GANJISESSID=826e55f6ec397d421876d60eddeb9b76; sscode=ok%2FU3YcPpemPfJQPokXROutr; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; last_name=elingsoft123; STA_DS=1; nTalk_CACHE_DATA={uid:kf_10111_ISME9754_568760582}; NTKF_T2D_CLIENTID=guestA308F3D1-01E9-9234-6C4A-D489AC18228C; lg=1; citydomain=nb; __utma=32156897.1762231046.1444439497.1447203159.1447212544.14; __utmc=32156897; __utmz=32156897.1447212544.14.8.utmcsr=ganji.com|utmccn=(referral)|utmcmd=referral|utmcct=/vip/my_post_list.php; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A31958504601%7D", ".ganji.com", new CookieCollection()));

            //////////////////////////////////////////////////////////////////////////
            //  req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; citydomain=nb;  sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D;  last_name=elingsoft123", ".ganji.com", new CookieCollection()));
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(bs, 0, bs.Length);
                reqStream.Close();
            }

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            using (Stream stream = res.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(stream))
                {
                    string msg = streamReader.ReadToEnd();
                    if (!string.IsNullOrEmpty(msg) & msg.IndexOf("success") > 0)
                    {
                        this.LastStatus = "发布出租成功";
                        return msg;

                    }
                    else
                    {

                        this.LastStatus = "发布出租失败";
                        return msg;

                    }
                    int a = res.Cookies.Count;
                    if (a > 0)
                    {


                        cklist.Add(res.Cookies);
                    }
                    //    string lc = res.Headers["Location"].ToString();
                    return msg;
                }
            }

            return "";

        }

        /// <summary>
        /// 出售发布
        /// </summary>
        /// <param name="allowdir"></param>
        /// <param name="urla"></param>
        /// <param name="postdata"></param>
        /// <returns></returns>
        public string doreqoutPub1(bool allowdir, string urla, string postdata)
        {

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(urla);

            req.CookieContainer = new CookieContainer();
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/7.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0E; .NET4.0C; Tablet PC 2.0; InfoPath.3)";

            //11.11 
            req.CookieContainer.Add(cklist);
            req.Headers.Add("Upgrade-Insecure-Requests", "1");
            req.Referer = "http://www.ganji.com/pub/pub.php?act=pub&method=load&cid=7&mcid=20&domain=nb";
            req.Method = "POST";
            if (this.wp != null)
            {
                req.Proxy = wp;
            }
            req.AllowAutoRedirect = allowdir;


            req.Method = "POST";

            StringBuilder sb = new StringBuilder();

            sb.Append("type=" + HttpUtility.UrlEncode(type) + "&");

            sb.Append("isBiz=" + HttpUtility.UrlEncode(isBiz) + "&");
            sb.Append("xiaoqu=" + HttpUtility.UrlEncode(xiaoqu) + "&");
            sb.Append("xiaoquname=" + HttpUtility.UrlEncode(xiaoquname) + "&");
            sb.Append("localArea=" + HttpUtility.UrlEncode(localArea) + "&");
           


            sb.Append("localDiduan=" + HttpUtility.UrlEncode(localDiduan) + "&");
            sb.Append("dizhi=" + HttpUtility.UrlEncode(dizhi) + "&");
            sb.Append("huxingshi=" + HttpUtility.UrlEncode(huxingshi) + "&");
            sb.Append("huxingting=" + HttpUtility.UrlEncode(huxingting) + "&");





            sb.Append("huxingwei=" + HttpUtility.UrlEncode(huxingwei) + "&");
            sb.Append("taoneimianji=" + HttpUtility.UrlEncode(taoneimianji) + "&");
            sb.Append("Floor=" + HttpUtility.UrlEncode(Floor) + "&");
            sb.Append("zonglouceng=" + HttpUtility.UrlEncode(zonglouceng) + "&");






            sb.Append("Toward=" + HttpUtility.UrlEncode(Toward) + "&");
            sb.Append("ObjectType=" + HttpUtility.UrlEncode(ObjectType) + "&");
            sb.Append("fittype=" + HttpUtility.UrlEncode(fittype) + "&");
            sb.Append("chanquannianxian=" + HttpUtility.UrlEncode(chanquannianxian) + "&");

            sb.Append("chanquan=" + HttpUtility.UrlEncode(chanquan) + "&");
            sb.Append("jianzhuniandai=" + HttpUtility.UrlEncode(jianzhuniandai) + "&");
            sb.Append("fangyuantese=" + HttpUtility.UrlEncode(fangyuantese) + "&");
            sb.Append("MinPrice=" + HttpUtility.UrlEncode(MinPrice) + "&");








            sb.Append("Title=" + HttpUtility.UrlEncode(Title) + "&");
            sb.Append("Content=" + HttpUtility.UrlEncode(Content) + "&");
            sb.Append("Pic=" + HttpUtility.UrlEncode(Pic) + "&");






            sb.Append("goblianxiren=" + HttpUtility.UrlEncode(goblianxiren) + "&");
            sb.Append("globalQQOpenId=" + HttpUtility.UrlEncode(globalQQOpenId) + "&");
            sb.Append("postparam_openidtype=" + HttpUtility.UrlEncode(postparam_openidtype) + "&");
            sb.Append("Phone=" + HttpUtility.UrlEncode(Phone) + "&");







            sb.Append("cube_post_jsonkey=" + HttpUtility.UrlEncode(cube_post_jsonkey) + "&");
            sb.Append("userid=" + HttpUtility.UrlEncode(userid) + "&");
            sb.Append("captcha_type=" + HttpUtility.UrlEncode(captcha_type) + "&");
            sb.Append("captcha_input=" + HttpUtility.UrlEncode(captcha_input) + "&");





            sb.Append("GTID=" + HttpUtility.UrlEncode(GTID) + "&");


            byte[] bs = Encoding.UTF8.GetBytes(sb.ToString());

            string pt = "application/x-www-form-urlencoded; charset=UTF-8";
            req.ContentType = pt;
            req.ContentLength = bs.Length;
            req.Accept = "gzip, deflate";
            // req.CookieContainer = new System.Net.CookieContainer();
            //   req.CookieContainer.Add( strCokAddColnew("lg=1; ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; __utma=32156897.89665725.1446446419.1446446419.1446685942.2; __utmz=32156897.1446446419.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); undefined=0b599f13-59bb-4046-a877-352f7c5bc2c5; citydomain=nb; NTKF_T2D_CLIENTID=guest016AF395-C541-D138-A824-C6F7D48CE723; sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; __utmb=32156897.10.10.1446685942; __utmt=1; 58uuid=d60ba0ca-88f0-4122-bbf5-a6cda97fde62; last_name=elingsoft123; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A33801389483%7D; __utmc=32156897; GANJISESSID=ac5c6e3d6fe1e048616e1913f6266fa9",".ganji.com",new CookieCollection()));
            //11.11
            // req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=5170713550418216074941; ganji_xuuid=a00bd1e8-8802-4d0f-8737-20af1e6f4f17; undefined=51fcc4f3-d030-4435-85e1-171248097f40; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D; bdshare_firstime=1446620003045; 58uuid=a8a7d56c-88fd-46a0-872a-85a370f9b007; GANJISESSID=826e55f6ec397d421876d60eddeb9b76; sscode=ok%2FU3YcPpemPfJQPokXROutr; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; last_name=elingsoft123; STA_DS=1; nTalk_CACHE_DATA={uid:kf_10111_ISME9754_568760582}; NTKF_T2D_CLIENTID=guestA308F3D1-01E9-9234-6C4A-D489AC18228C; lg=1; citydomain=nb; __utma=32156897.1762231046.1444439497.1447203159.1447212544.14; __utmc=32156897; __utmz=32156897.1447212544.14.8.utmcsr=ganji.com|utmccn=(referral)|utmcmd=referral|utmcct=/vip/my_post_list.php; _gl_tracker=%7B%22ca_source%22%3A%22-%22%2C%22ca_name%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_id%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22sid%22%3A31958504601%7D", ".ganji.com", new CookieCollection()));

            //////////////////////////////////////////////////////////////////////////
            //  req.CookieContainer.Add(strCokAddColnew("lg=1;ganji_uuid=8295570832976495518323; ganji_xuuid=8c2c4ca2-2758-42a0-90b1-037bf7bd2621.1441182165740; citydomain=nb;  sscode=6YJzZSDvFyZ0a0Uw6YSYtzmR; GanjiUserName=elingsoft123; GanjiUserInfo=%7B%22user_id%22%3A568760582%2C%22email%22%3A%22%22%2C%22username%22%3A%22elingsoft123%22%2C%22user_name%22%3A%22elingsoft123%22%2C%22nickname%22%3A%22%22%7D; bizs=%5B%5D; supercookie=AGL4AmLjAGtlWQyvMQL5BGV4MzZ2LJAwBQAzZQZlMwyvBTZlMQyyMJSzMGV3BTMvZTL%3D;  last_name=elingsoft123", ".ganji.com", new CookieCollection()));
            using (Stream reqStream = req.GetRequestStream())
            {
                reqStream.Write(bs, 0, bs.Length);
                reqStream.Close();
            }

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            using (Stream stream = res.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(stream))
                {
                    string msg = streamReader.ReadToEnd();
                    if (!string.IsNullOrEmpty(msg) & msg.IndexOf("success") > 0)
                    {
                        this.LastStatus = "发布出售成功";
                        return msg;

                    }
                    else
                    {

                        this.LastStatus = "发布出售失败";
                        return msg;

                    }
                    int a = res.Cookies.Count;
                    if (a > 0)
                    {


                        cklist.Add(res.Cookies);
                    }
                    //    string lc = res.Headers["Location"].ToString();
                    return msg;
                }
            }

            return "";

        }
    }
}
